const babelCore = require('@babel/core')

const code = `
  {
    let a = 3;
    let b = 4;
  }
  
  let a = 3;
  let c = 5;
`
const result = babelCore.transformSync(code,{
    plugins: ["@babel/plugin-transform-block-scoping"]
})

console.log(result.code);